<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>RT-Thread RTOS: Application Module</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">RT-Thread RTOS
   &#160;<span id="projectnumber">1.2.0</span>
   </div>
   <div id="projectbrief">An open source embedded real-time operating system</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group___module.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Application Module</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structrt__module.html">rt_module</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:gac9cf009cdd711aada15c637c09348976"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___module.html#gac9cf009cdd711aada15c637c09348976">RT_MODULE_FLAG_WITHENTRY</a>&#160;&#160;&#160;0x00</td></tr>
<tr class="separator:gac9cf009cdd711aada15c637c09348976"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9b618fe8b0480194183246ef0403fa30"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___module.html#ga9b618fe8b0480194183246ef0403fa30">RT_MODULE_FLAG_WITHOUTENTRY</a>&#160;&#160;&#160;0x01</td></tr>
<tr class="separator:ga9b618fe8b0480194183246ef0403fa30"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga19ae3a3f106e5511624cab485a39c93b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structrt__module.html">rt_module_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___module.html#ga19ae3a3f106e5511624cab485a39c93b">rt_module_load</a> (const char *name, void *module_ptr)</td></tr>
<tr class="separator:ga19ae3a3f106e5511624cab485a39c93b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa9132b4920b970e0a730e27df7dac60b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group___basic_def.html#ga42df42aabf676f2a89f5af2208b79950">rt_err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___module.html#gaa9132b4920b970e0a730e27df7dac60b">rt_module_unload</a> (<a class="el" href="structrt__module.html">rt_module_t</a> module)</td></tr>
<tr class="separator:gaa9132b4920b970e0a730e27df7dac60b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga14ca8aed2d7db27b8f1372e45ac6edc1"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structrt__module.html">rt_module_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___module.html#ga14ca8aed2d7db27b8f1372e45ac6edc1">rt_module_open</a> (const char *filename)</td></tr>
<tr class="separator:ga14ca8aed2d7db27b8f1372e45ac6edc1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5b68b8f419b06f9e382f1cd35b0de324"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structrt__module.html">rt_module_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___module.html#ga5b68b8f419b06f9e382f1cd35b0de324">rt_module_self</a> (void)</td></tr>
<tr class="separator:ga5b68b8f419b06f9e382f1cd35b0de324"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf9753b1c59c3d363de611e3be761c17d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structrt__module.html">rt_module_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___module.html#gaf9753b1c59c3d363de611e3be761c17d">rt_module_find</a> (const char *name)</td></tr>
<tr class="separator:gaf9753b1c59c3d363de611e3be761c17d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae6da0f4b7b9afc54b8666a0581ec4ed0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___module.html#gae6da0f4b7b9afc54b8666a0581ec4ed0">rt_module_load_sethook</a> (void(*hook)(<a class="el" href="structrt__module.html">rt_module_t</a> module))</td></tr>
<tr class="separator:gae6da0f4b7b9afc54b8666a0581ec4ed0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga967257af8155a771eca4807da56d264e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___module.html#ga967257af8155a771eca4807da56d264e">rt_module_unload_sethook</a> (void(*hook)(<a class="el" href="structrt__module.html">rt_module_t</a> module))</td></tr>
<tr class="separator:ga967257af8155a771eca4807da56d264e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Application Module is implemented as dynamic object loader, but it can handle the dependences relationship between application and dynamic library, moreover, it also can handle the kernel object destroy and memory release issue when application (abnormally) exit. </p>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="gac9cf009cdd711aada15c637c09348976"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RT_MODULE_FLAG_WITHENTRY&#160;&#160;&#160;0x00</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>with entry point </p>

</div>
</div>
<a class="anchor" id="ga9b618fe8b0480194183246ef0403fa30"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define RT_MODULE_FLAG_WITHOUTENTRY&#160;&#160;&#160;0x01</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>without entry point </p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga19ae3a3f106e5511624cab485a39c93b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structrt__module.html">rt_module_t</a> rt_module_load </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>module_ptr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will load a module from memory and create a thread for it</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>the name of module, which shall be unique </td></tr>
    <tr><td class="paramname">module_ptr</td><td>the memory address of module image</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the module object </dd></dl>

</div>
</div>
<a class="anchor" id="gaa9132b4920b970e0a730e27df7dac60b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group___basic_def.html#ga42df42aabf676f2a89f5af2208b79950">rt_err_t</a> rt_module_unload </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structrt__module.html">rt_module_t</a>&#160;</td>
          <td class="paramname"><em>module</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will unload a module from memory and release resources</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">module</td><td>the module to be unloaded</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the operation status, RT_EOK on OK; -RT_ERROR on error </dd></dl>

</div>
</div>
<a class="anchor" id="ga14ca8aed2d7db27b8f1372e45ac6edc1"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structrt__module.html">rt_module_t</a> rt_module_open </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>path</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will load a module from a file</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">path</td><td>the full path of application module</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the module object </dd></dl>

</div>
</div>
<a class="anchor" id="ga5b68b8f419b06f9e382f1cd35b0de324"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structrt__module.html">rt_module_t</a> rt_module_self </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will return self module object</p>
<dl class="section return"><dt>Returns</dt><dd>the self module object </dd></dl>

</div>
</div>
<a class="anchor" id="gaf9753b1c59c3d363de611e3be761c17d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structrt__module.html">rt_module_t</a> rt_module_find </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will find the specified module.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>the name of module finding</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the module </dd></dl>

</div>
</div>
<a class="anchor" id="gae6da0f4b7b9afc54b8666a0581ec4ed0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rt_module_load_sethook </td>
          <td>(</td>
          <td class="paramtype">void(*)(<a class="el" href="structrt__module.html">rt_module_t</a> module)&#160;</td>
          <td class="paramname"><em>hook</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will set a hook function, which will be invoked when module be loaded to system.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">hook</td><td>the hook function </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga967257af8155a771eca4807da56d264e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void rt_module_unload_sethook </td>
          <td>(</td>
          <td class="paramtype">void(*)(<a class="el" href="structrt__module.html">rt_module_t</a> module)&#160;</td>
          <td class="paramname"><em>hook</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>This function will set a hook function, which will be invoked when module be unloaded from system.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">hook</td><td>the hook function </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Mon Jan 6 2014 23:05:02 for RT-Thread RTOS by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.5 </li>
  </ul>
</div>
</body>
</html>
